﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="present_sort.aspx.cs" Inherits="EZCRS.HCMS.Web.manage.present.present_sort" %>

<%@ Register Src="../usercontrol/titlepage.ascx" TagName="titlepage" TagPrefix="uc2" %>
<%@ Register Assembly="Book38.Net.CustomControl" Namespace="Book38.Net.CustomControl"
    TagPrefix="cc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

    <script language="javascript" type="text/javascript">
function goUp(obj,cellnum){
	curRow = obj.parentElement.parentElement;
	var curLn = curRow.rowIndex;
	var lastLn = curRow.rowIndex - 1;

	if (curLn!=1){
		lastRow = obj.parentElement.parentElement.parentElement.rows[lastLn];
		for(var i=0;i<cellnum;i++){
			tmpHtml = curRow.cells[i].innerHTML;
			curRow.cells[i].innerHTML = lastRow.cells[i].innerHTML;
			lastRow.cells[i].innerHTML = tmpHtml;
		}
	}else{
		alert("Cannot move up");
	}
}

//-----order list go down------

function goDown(obj,cellnum){
	totalRows = obj.parentElement.parentElement.parentElement.rows.length - 1;
	curRow = obj.parentElement.parentElement;
	var curLn = curRow.rowIndex;
	var lastLn = curRow.rowIndex + 1;

	if (totalRows != curLn) {
		lastRow = obj.parentElement.parentElement.parentElement.rows[lastLn]
		for(var i=0;i<cellnum;i++){
			tmpHtml = curRow.cells[i].innerHTML;
			curRow.cells[i].innerHTML = lastRow.cells[i].innerHTML;
			lastRow.cells[i].innerHTML = tmpHtml;
		}
	}else{
		alert("Cannot Move Down!");
	}
}




/*get all*/
function getall()
{
  EZCRS.HCMS.myajax.Present.sortall(resall);
}
function resall(resp)
{
  $F("lsort").innerHTML=resp.value;
}

/*modify rank*/
function modisort(obj)
{
 $F("sname").value=obj.parentElement.parentElement.parentElement.cells[1].innerHTML;
 $F("sid").value=obj.parentElement.parentElement.parentElement.cells[0].innerHTML;
 $F("btnsubmit").value="修改";
}

function savesort()
{debugger
  obj=$F("tlist");
  var str="";
  for(var i=1;i<obj.rows.length;i++)
  {
     str+=","+obj.rows[i].cells[0].innerHTML;
  }
  EZCRS.HCMS.myajax.Present.saverank(str,resps);
}
function resps(resp)
{
 if(resp.value=="1")
   {alert("更新成功！");}
}



function saveclass()
{
  if($F("sname").value!="")
  {
    EZCRS.HCMS.myajax.Present.savesort($F("sname").value,$F("sid").value,classresp);
  }
}

function classresp(resp)
{
  if(resp.value=="1")
  {
    if($F("sid").value!="0")
    {
      alert("分类信息修改成功！");
    }
    else
    {
       alert("分类信息添加成功！");
    }
    $F("sid").value="0";
    $F("sname").value="";
    $F("btnsubmit").value="添加";
    getall();
  }
}

// del
function jsdelsort(obj)
{  if(confirm('<%= Resources.Site.ScriptConfirm %>'))
{
    EZCRS.HCMS.myajax.Present.delsort(obj.parentElement.parentElement.parentElement.cells[0].innerHTML,respdel);
    }
}

function respdel(resp)
{
  if(resp.value=="1")
  {
    alert("<%= Resources.Site.ScriptDelSuccess %>");
    getall();
  }
}
    </script>

    <title></title>
</head>
<body onload="javascript:getall();">
    <form id="formData" runat="server">
    <uc2:titlepage ID="Titlepage1" runat="server" inittitle="<%$ Resources:Site, LabCardUserLevelSetup %>">
    </uc2:titlepage>
    <div class="optbar">
        <a href="javascript:savesort();" class="blue" onmouseover="currentcolor=this.style.backgroundColor;this.style.backgroundColor='#B9CEEA';"
            onmouseout="this.style.backgroundColor=currentcolor;">
            <img src="../../image/save.gif" border="0" align="absmiddle" /><asp:Literal runat="server"
                Text="<%$ Resources:Site, Labsavepresentsort %>" ID="literal1"></asp:Literal></a></div>
    <div class="mid" id="lsort">
    </div>
    <br />
    <table class="main-table" cellspacing="1">
        <tr class="line-odd">
            <td colspan="2">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="206">
                            <asp:Label ID="Label1" runat="server" Text="<%$ Resources:Site, Labpresentsort %>"></asp:Label>：
                        </td>
                        <td>
                            &nbsp;<cc2:WebTextBox ID="sname" runat="server" Width="150px" CssClass="text-line"
                                MaxLength="50"></cc2:WebTextBox>
                            &nbsp;<asp:Button ID="btnsubmit" runat="server" CssClass="bttn" Text="<%$ Resources:Site, ButtonSave %>" /><input
                                type="hidden" id="sid" value="0" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
